HAL RAMCFG Functions

ECC operation functions

group RAMCFG_Exported_Functions_Group1

This section provides functions to manage the ECC feature provided by the RAMCFG peripheral.

  • Call the function HAL_RAMCFG_ECC_Enable() to enable the ECC error monitoring process and latch the error address in silent mode.

  • Call the function HAL_RAMCFG_ECC_Enable_IT() to enable the ECC error monitoring process and latch the error address in interrupt mode (only interrupts specified in the dedicated function parameter are enabled).

  • Call the function HAL_RAMCFG_ECC_Disable() to disable and stop ECC monitoring for the selected RAMCFG instance.

  • Call the function HAL_RAMCFG_ECC_GetInfo() to get the RAMCFG ECC information.

Functions

hal_status_t HAL_RAMCFG_ECC_Enable ( hal_ramcfg_t instance )

Enable ECC monitoring with error address latching for the given RAMCFG instance.

Parameters :

instance – RAMCFG instance.

Return values :

HAL_OK – ECC monitoring enabled successfully.

hal_status_t HAL_RAMCFG_ECC_Enable_IT ( hal_ramcfg_t instance , uint32_t interrupt )

Enable ECC monitoring with error address latching and given interrupt(s) for the given RAMCFG instance.

Parameters :
  • instance – RAMCFG instance.

  • interrupt – Interrupt(s) to be enabled. This parameter can be one or a combination of the following values:

    • HAL_RAMCFG_IT_ECC_SINGLE

    • HAL_RAMCFG_IT_ECC_DOUBLE

    • HAL_RAMCFG_IT_ECC_DOUBLE_NMI

Return values :

HAL_OK – ECC monitoring enabled successfully.

hal_status_t HAL_RAMCFG_ECC_Disable ( hal_ramcfg_t instance )

Disable ECC monitoring for the given RAMCFG instance.

Parameters :

instance – RAMCFG instance.

Return values :

HAL_OK – ECC monitoring disabled successfully.

void HAL_RAMCFG_ECC_GetInfo ( hal_ramcfg_t instance , hal_ramcfg_ecc_info_t * p_info )

Get the ECC information.

Parameters :

Write protection functions

group RAMCFG_Exported_Functions_Group3

This section provides functions to enable the write protection feature for the page(s) of the given SRAM. SRAM page protection can be disabled only by a global peripheral reset or a system reset.

Functions

hal_status_t HAL_RAMCFG_EnablePageWRP ( hal_ramcfg_t instance , uint32_t start_page , uint32_t page_nbr )

Enable write protection for the given page(s).

Parameters :
  • instance – RAMCFG instance.

  • start_page – Select the start page number.

  • page_nbr – Number of pages to be protected.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter when the number of pages to protect is higher than the number of pages available for the given SRAM.

  • HAL_OK – RAMCFG pages are successfully protected.

hal_status_t HAL_RAMCFG_EnableWRPByAddr ( hal_ramcfg_t instance , uint32_t sram_addr , uint32_t size_byte )

Enable write protection for the given SRAM address range.

Warning

Physically, the SRAM protection granularity is a page. When sram_addr does not correspond to the start of a page and size_byte does not cover an integer number of pages, the driver rounds to the first and last pages to cover the area defined by sram_addr and size_byte.

Parameters :
  • instance – RAMCFG instance.

  • sram_addr – Start of the address range to be protected.

  • size_byte – Size of address range to be protected (in bytes).

Return values :
  • HAL_INVALID_PARAM – Invalid parameter when sram_addr is not in the range of the given SRAM and the total size to be protected is larger than the given SRAM size.

  • HAL_OK – RAMCFG pages are successfully protected by address.

hal_ramcfg_wrp_page_status_t HAL_RAMCFG_IsEnabledPageWRP ( hal_ramcfg_t instance , uint32_t page )

Check the write protection status for the given page.

Parameters :
  • instance – RAMCFG instance.

  • page – Select the page index.

Return values :

Return – value can be one element of hal_ramcfg_wrp_page_status_t enumeration.

hal_ramcfg_wrp_page_status_t HAL_RAMCFG_IsEnabledWRPByAddr ( hal_ramcfg_t instance , uint32_t sram_addr )

Check the write protection status for the given SRAM by address.

Warning

Physically, the SRAM protection granularity is a page. When sram_addr does not correspond to the start of a page, the driver checks the status for the page containing the given sram_addr.

Parameters :
  • instance – RAMCFG instance.

  • sram_addr – Address to check for protection.

Return values :

Return – value can be one element of hal_ramcfg_wrp_page_status_t enumeration.

Erase operation functions

group RAMCFG_Exported_Functions_Group4

This section provides a function that performs a hardware erase of a given SRAM.

  • Call the function HAL_RAMCFG_MassErase() to perform a hardware mass erase of the given SRAM. Once erased, the SRAM content is zero.

Functions

hal_status_t HAL_RAMCFG_MassErase ( hal_ramcfg_t instance , uint32_t timeout )

Launch a mass erase for the given SRAM.

Parameters :
  • instance – RAMCFG instance.

  • timeout – User timeout to finish the mass erase.

Return values :
  • HAL_TIMEOUT – In case of user timeout.

  • HAL_OK – SRAM is successfully erased.

Handle interrupt and callbacks functions

group RAMCFG_Exported_Functions_Group5

This section provides functions to handle RAMCFG interrupts and register callbacks.

Functions

void HAL_RAMCFG_IRQHandler ( hal_ramcfg_t instance )

Handle RAMCFG interrupt request.

Parameters :

instance – RAMCFG instance.

hal_status_t HAL_RAMCFG_NMI_IRQHandler ( hal_ramcfg_t instance )

Handle RAMCFG NMI interrupt request.

Parameters :

instance – RAMCFG instance.

Return values :
  • HAL_OK – when the NMI has been specifically treated by this IRQHandler.

  • HAL_ERROR – otherwise.

hal_status_t HAL_RAMCFG_ECC_ErrorCallback ( hal_ramcfg_t instance )

RAMCFG single or double error detection callback.

Parameters :

instance – RAMCFG instance.

Return values :

HAL_ERROR – when the NMI has not been treated by the callback.

SRAM info getter functions

group RAMCFG_Exported_Functions_Group6

This section provides functions to get RAMCFG instance information.

Functions

RAMCFG_TypeDef * HAL_RAMCFG_GetLLInstance ( hal_ramcfg_t instance )

Get the selected hardware RAMCFG instance.

Parameters :

instance – RAMCFG instance.

Return values :

The – selected hardware RAMCFG instance.

uint32_t HAL_RAMCFG_GetSRAMBaseAddress ( hal_ramcfg_t instance )

Get the RAMCFG SRAM base address.

Parameters :

instance – RAMCFG instance.

Return values :

uint32_t – The base address of the given SRAM.

uint32_t HAL_RAMCFG_GetSRAMSize ( hal_ramcfg_t instance )

Get the RAMCFG SRAM size in bytes.

Parameters :

instance – RAMCFG instance.

Return values :

uint32_t – The size of the given SRAM in bytes.